import { Component } from 'react';
import { TabBar } from 'saltui';

export default class PageHome extends Component {
 constructor(props) {
    super(props);

    //是否需要底部tab页
    this.hasBottomTab =  document.getElementById("hasBottomTab").value;
    this.hasBottomTab=1;

    // this.tabBarItems = [
    //   { title: '会议室',icon:<span className="iconfont icon-tab-meeting"></span>,path: '/star'},
    //   { title: '办理', icon: <span className="iconfont icon-tab-approve"></span>,path: '/b/star'},
    //   { title: '我的会议', icon: <span className="iconfont icon-mine"></span>,path: '/a/star'},
    //   { title: '纪要', icon: <span className="iconfont icon-report"></span>,path: '/b/star'},
    //   { title: '任务', icon: <span className="iconfont icon-task"></span>,path: '/b/star'}
    // ];

    this.tabBarItems = [
      { title: '会议通知',icon:<span className="iconfont icon-notice"></span>,path: '/star'},
      { title: '我的会议', icon: <span className="iconfont icon-mine"></span>,path: '/a/star'},
      { title: '会议室', icon:<span className="iconfont icon-meet"></span>,path: '/star'},
      { title: '预定审批', icon: <span className="iconfont icon-tab-approve"></span>,path: '/b/star'},
    ];
  }

  changeActiveIndex(activeIndex){
    // 这里是触发每个item之后的回调，会返回当前点击的item的index 值
    // if(activeIndex == 0){
    //   location.hash = 'meeting/boardRoomview';
    // }else if(activeIndex == 1){
    //   location.hash = 'meeting/roomBpmList';
    // }else if(activeIndex == 2){
    //   location.hash = 'meeting/meetingList';
    // }else if(activeIndex == 3){
    //   location.hash = 'meeting/memo';
    // }else if(activeIndex == 4){
    //   location.hash = 'meeting/taskMineList';
    // }
    if(activeIndex == 0){
      location.hash = 'meeting/meetingNotice';
    }else if(activeIndex == 1){
      location.hash = 'meeting/meetingList';
    }else if(activeIndex == 2){
      location.hash = 'meeting/boardRoomview';
    }else if(activeIndex == 3){
      location.hash = 'meeting/roomBpmList';
    }
  }

  render() {
    const t = this;
    return (
        <div className={t.hasBottomTab == "0"?"t-DN":""}>
            <TabBar activeIndex={t.props.activeIndex} onChange={t.changeActiveIndex.bind(this)} iconHeight={24} cIconHeight={50} items={t.tabBarItems} />
        </div>
    );
  }
}


